# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=biber2.19
pkgver=2.19
pkgrel=1
provides="biber=$pkgver-r$pkgrel"
pkgdesc="Backend processor for BibLaTeX"
url="https://github.com/plk/biber"
# ARM: tests failing in the builders
arch="noarch !x86 !ppc64le !s390x !riscv64 !loongarch64 !armhf !armv7"
license="Artistic-2.0"
# HACK: This actually depends on biblatex~3.19, but that is not provided at
# global scope
makedepends="
	perl-config-autoconf
	perl-extutils-libbuilder
	perl-module-build
	texmf-dist-bibtexextra
	"
# This version should be compatible with biblatex, e.g. 2.20 need biblatex~3.20
# See Section "2.3 Compatibility Matrix" in
# https://markov.htwsaar.de/tex-archive/biblio/biber/base/documentation/biber.pdf
depends="
	perl
	perl-autovivification
	perl-business-isbn
	perl-business-ismn
	perl-business-issn
	perl-class-accessor
	perl-data-compare
	perl-data-dump
	perl-data-uniqid
	perl-date-simple
	perl-datetime-calendar-julian
	perl-datetime-format-builder
	perl-encode-eucjpascii
	perl-encode-hanextra
	perl-encode-jis2k
	perl-file-slurp
	perl-file-slurper
	perl-io-string
	perl-ipc-run3
	perl-lingua-translit
	perl-list-allutils
	perl-list-moreutils
	perl-list-moreutils-xs
	perl-log-log4perl
	perl-lwp-protocol-https
	perl-mime-charset
	perl-mozilla-ca
	perl-namespace-autoclean
	perl-parse-recdescent
	perl-perlio-utf8_strict
	perl-regexp-common
	perl-sort-key
	perl-text-bibtex
	perl-text-csv
	perl-text-csv_xs
	perl-text-roman
	perl-unicode-collate
	perl-unicode-linebreak
	perl-xml-libxml
	perl-xml-libxml-simple
	perl-xml-libxslt
	perl-xml-writer
	"
checkdepends="
	perl-file-which
	perl-test-differences
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/plk/biber/archive/v$pkgver.tar.gz"
builddir="$srcdir/biber-$pkgver"

build() {
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')

	perl Build.PL \
		--installdirs=vendor \
		--create_packlist=0
	./Build
}

check() {
	./Build test
}

package() {
	# HACK: Not adding this at global scope, as biblatex~3.19 is not provided
	# at global scope
	depends="$depends biblatex~3.19"

	./Build install --destdir="$pkgdir"
}

sha512sums="
427edd042e25fd6b763d60ad5bd3ce6fb68f9d6b15dfe387edc8c8445022cb2a4ba0999d7890fc51798dd95cbe82f82f6fc40b58df5a502c9c9b8485806c56d5  biber2.19-2.19.tar.gz
"
